var UserPersister = Class.create({
	init: function (rootUrl) {
		//...api/user/
		this.rootUrl = rootUrl + "user/";
	},
	login: function (user, success, error) {
		var url = this.rootUrl + "login";
		var userData = {
			username: user.username,
			authCode: CryptoJS.SHA1(user.username + user.password).toString()
		};

		httpRequester.postJSON(url, userData,
			function (data) {
				saveUserData(data);
				success(data);
			}, error);
	},
	register: function (user, success, error) {
		var url = this.rootUrl + "register";
		var userData = {
			username: user.username,
			nickname: user.nickname,
			authCode: CryptoJS.SHA1(user.username + user.password).toString()
		};
		httpRequester.postJSON(url, userData,
			function (data) {
				saveUserData(data);
				success(data);
			}, error);
	},
	logout: function (success, error) {
		var url = this.rootUrl + "logout/" + sessionKey;
		httpRequester.getJSON(url, function (data) {
			clearUserData();
			success(data);
		}, error)
	},
});